package com.iwhalecloud.bss.kite.cucc.service.attr.handler;

import com.iwhalecloud.bss.kite.common.constant.KeyConsts;
import com.iwhalecloud.bss.kite.common.util.KiteStringUtils;
import com.iwhalecloud.bss.kite.cucc.common.constant.LocalKeyConsts;
import com.iwhalecloud.bss.kite.manager.api.IQuerySceneInstService;
import com.iwhalecloud.bss.kite.manager.inst.KiteAttr;
import com.iwhalecloud.bss.kite.manager.inst.KiteInst;
import com.iwhalecloud.bss.kite.manager.inst.KiteSceneInst;
import com.iwhalecloud.bss.kite.service.attr.AttrData;
import com.iwhalecloud.bss.kite.service.attr.handler.AbstractAttrHandler;
import com.ztesoft.bss.common.util.ContextUtil;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * A端客户名称
 * */
public class AClientAttrHandler extends AbstractAttrHandler {

    @Autowired
    private IQuerySceneInstService querySceneInstService;

    @Override
    public void after(KiteAttr attr, KiteInst inst, AttrData data) {
        // 河南、黑龙江 MV A端客户名称必填
        KiteSceneInst sceneInst = querySceneInstService.getSceneInst(data.getSceneInstId());
        String provinceCode = sceneInst.getProvinceNbr();
        if (KiteStringUtils.equalsAny(provinceCode, LocalKeyConsts.PROVINCE_HENAN, LocalKeyConsts.PROVINCE_HEILONGJIANG)) {
            attr.setIsNull(KeyConsts.IFTRUE_F);
        }
        super.after(attr, inst, data);
    }
}
